Dynomotion

Group: DynoMotion Message: 6230 From: daveymahomh600e Date: 12/7/2012
Subject: KMotionCNC Question
Hello All,
I have been using KMOtionCNC for about a week now and I really like it's simplicity and clean operation.

However, something that I feel would be a big asset would be to have status or comment line or window where we could see system messages similar to the console in KMotion. Since there are so many times that new programs or routines have to be tested, it would be nice to have this kind of feedback from within the KMotionCNC screen, especially for debugging.

One other issue I am struggling with is when the machine moves into a limit switch in KMOtionCNC it disables that axis and there is no way I have found to move it back out, regardless of how the limit switch settings are configured. When I first start my machine I have a User button to initialize the motors and also a Homing button to locate and register the limit switches. The homing routine moves the slide slowly until it trips the switch and then backs out by a set amount. If they are tripped by jogging or bad programming the only way I've found out is to shut things down and use Kmotion (not CNC) to get going again.

Thanks for any guidance,
David.
Group: DynoMotion Message: 6231 From: Tom Kerekes Date: 12/7/2012
Subject: Re: KMotionCNC Question
Hi David,

Good questions, did you know that for debugging you can open the KMotion|Console Screen to see messages?

Do you have separate limit switches on each end of travel?  Or both switches wired together?

Regards
TK

Group: DynoMotion Message: 6232 From: David Stevenson Date: 12/7/2012
Subject: Re: KMotionCNC Question

Hi Tom,
 
I have been using the Console Screen, but I am thinking down the road where I really don't want the operator in the KMotion area, due to the danger of something getting modified by accident.
 
The 2 axis machine of mine has a limit switch on each end of both axis.
 
Something else I was wondering about... how would one go about changing functions associated with a gamepad device? Is that a driver from Logitech or whomever?
 
Thank you,
David.
-----Original Message-----
From: DynoMotion@yahoogroups.com [mailto:DynoMotion@yahoogroups.com]On Behalf Of Tom Kerekes
Sent: Friday, December 07, 2012 2:30 PM
To: DynoMotion@yahoogroups.com
Subject: Re: [DynoMotion] KMotionCNC Question

 

Hi David,

Good questions, did you know that for debugging you can open the KMotion|Console Screen to see messages?

Do you have separate limit switches on each end of travel?  Or both switches wired together?

Regards
TK

Group: DynoMotion Message: 6233 From: Tom Kerekes Date: 12/7/2012
Subject: Re: KMotionCNC Question
Hi David,

I wouldn't expect the Operator to be debugging things.  Any thoughts on where/how to put a console screen in KMotionCNC?  We're trying to keep things simple.

I was asking if the limit switches at both ends are wired in parallel or series and only one signal goes into KFLOP or do they go in as two separate signals.  If two separate signals, then the "Disallow drive into limit" option should allow you to re-initialize while in the limit and move back inside the limits.

The gamepad functions are all hard coded within KMotionCNC in the VS2008 C++ MFC code.  You would need to edit the code and recompile to change things.

Regards
TK

Group: DynoMotion Message: 6234 From: David Stevenson Date: 12/7/2012
Subject: Re: KMotionCNC Question

Hi Tom,
 
I was thinking just a single line size box on the main screen, perhaps with a scroll button that would simply show the last message printed by the system. Mach has one (they use an error box or something like that) and it's handy for seeing status messages... like "X+ Limit Triggered" or something similar.
 
My 4 limits have 4 separate inputs. I was thinking it can't re-initialize because the motors have to move "ever-so-slightly" in the wrong direction to initialize the servos.
 
Is the file you mention available to edit? I have a free version of Visual Studio, does that work?
 
Thanks,
David.
 
-----Original Message-----
From: DynoMotion@yahoogroups.com [mailto:DynoMotion@yahoogroups.com]On Behalf Of Tom Kerekes
Sent: Friday, December 07, 2012 3:05 PM
To: DynoMotion@yahoogroups.com
Subject: Re: [DynoMotion] KMotionCNC Question

 

Hi David,

I wouldn't expect the Operator to be debugging things.  Any thoughts on where/how to put a console screen in KMotionCNC?  We're trying to keep things simple.

I was asking if the limit switches at both ends are wired in parallel or series and only one signal goes into KFLOP or do they go in as two separate signals.  If two separate signals, then the "Disallow drive into limit" option should allow you to re-initialize while in the limit and move back inside the limits.

The gamepad functions are all hard coded within KMotionCNC in the VS2008 C++ MFC code.  You would need to edit the code and recompile to change things.

Regards
TK

Group: DynoMotion Message: 6235 From: Tom Kerekes Date: 12/7/2012
Subject: Re: KMotionCNC Question
Hi David,

I don't recall what kind of system you have, but the Limits trip on commanded motion in the wrong direction, not actual (encoder) motion in the wrong direction, so I'm not sure why there would be a problem.

The source code is available see KMotionCNCDlg.cpp.  But KMotionCNC is written in MFC (Microsoft Foundation Class) which is an older C++ Libraries which is not supported by the free Express versions.  You need at least the Standard Version of Visual Studio.

Regards
TK

Group: DynoMotion Message: 6236 From: David Stevenson Date: 12/7/2012
Subject: Re: KMotionCNC Question

Hi Tom,
 
My system uses a SnapAmp with 3 phase brushless motors. In KMotionCNC if I jog into a limit, the readout changes to yellow from green and the axis is disabled. Neither the gamepad or the jog buttons will move it back off the limit and the axis won't re-initialize with the User button.
 
Thanks for the information on the code.
 
Thanks again,
David.
 
-----Original Message-----
From: DynoMotion@yahoogroups.com [mailto:DynoMotion@yahoogroups.com]On Behalf Of Tom Kerekes
Sent: Friday, December 07, 2012 3:46 PM
To: DynoMotion@yahoogroups.com
Subject: Re: [DynoMotion] KMotionCNC Question

 

Hi David,

I don't recall what kind of system you have, but the Limits trip on commanded motion in the wrong direction, not actual (encoder) motion in the wrong direction, so I'm not sure why there would be a problem.

The source code is available see KMotionCNCDlg.cpp.  But KMotionCNC is written in MFC (Microsoft Foundation Class) which is an older C++ Libraries which is not supported by the free Express versions.  You need at least the Standard Version of Visual Studio.

Regards
TK

Group: DynoMotion Message: 6237 From: Tom Kerekes Date: 12/7/2012
Subject: Re: KMotionCNC Question
Hi David,

User Button (Init C Program) should re-initialize while in the limit if you are using the "Disable drive into limit" mode.  If you post your Init.c program I can look at it.

Regards
TK

Group: DynoMotion Message: 6238 From: David Stevenson Date: 12/7/2012
Subject: Re: KMotionCNC Question

Hi Tom,
 
here is the code...
 
#include "KMotionDef.h"
 
// Home and set the commutation for two 3-phase brushless motors
 
// Assume index mark 
 
main()
{
    float k=0,A=10.0f;   // set coil current amplitude PWM units
 double p0;
 
 WriteSnapAmp(SNAP0+SNAP_SUPPLY_CLAMP0 ,SNAP_CONVERT_VOLTS_TO_ADC(80.0));
 WriteSnapAmp(SNAP0+SNAP_SUPPLY_CLAMP1 ,SNAP_CONVERT_VOLTS_TO_ADC(80.0));
 
 WriteSnapAmp(SNAP0+SNAP_SUPPLY_CLAMP_ENA0,1);
 WriteSnapAmp(SNAP0+SNAP_SUPPLY_CLAMP_ENA1,1);
 
 WriteSnapAmp(SNAP0+SNAP_PEAK_CUR_LIMIT0,12);  // current limit (12 for BSM80C-375)
 WriteSnapAmp(SNAP0+SNAP_PEAK_CUR_LIMIT1,12);  // current limit
 
 Delay_sec(1);  // wait for any fault to clear
    
 // rotate until we find the index mark for ch0
 
 ch0->Enable=FALSE;
 ch0->OutputChan0=8;
 for (;;)
    {
     WaitNextTimeSlice();
  
  Write3PH(ch0,A, ++k/10000.0);  // move the pole
 
  if (ReadBit(66))  // check for index mark
  {
   p0=ch0->Position; // save position
   ch0->Position=0;  // set current position to Zero
   
   ch0->CommutationOffset = 2875;
   
   printf("Position X axis = %f\n",p0);
   break;
  }
    }
 
 Write3PH(ch0,0,0);    // turn off the coil   
 
 // define the axis as 3 phase BRUSHLESS_3PH_MODE
 // and set low PID gains
 
 ch0->InputMode=ENCODER_MODE;
 ch0->OutputMode=BRUSHLESS_3PH_MODE;
 ch0->Vel=150000;
 ch0->Accel=1e+008;
 ch0->Jerk=1e+010;
 ch0->P=0.1;
 ch0->I=0;
 ch0->D=0;
 ch0->FFAccel=0;
 ch0->FFVel=0;
 ch0->MaxI=200;
 ch0->MaxErr=100000;
 ch0->MaxOutput=2000;
 ch0->DeadBandGain=1;
 ch0->DeadBandRange=0;
 ch0->InputChan0=8;
 ch0->InputChan1=4;
 ch0->OutputChan0=8;
 ch0->OutputChan1=9;
 ch0->MasterAxis=-1;
 ch0->LimitSwitchOptions=0x4b49001f;
 ch0->InputGain0=1;
 ch0->InputGain1=1;
 ch0->InputOffset0=0;
 ch0->InputOffset1=0;
 ch0->OutputGain=1;
 ch0->OutputOffset=0;
 ch0->SlaveGain=1;
 ch0->BacklashMode=BACKLASH_OFF;
 ch0->BacklashAmount=0;
 ch0->BacklashRate=0;
 ch0->invDistPerCycle=0.0002;
 ch0->Lead=0;
 ch0->MaxFollowingError=400000;
 ch0->StepperAmplitude=20;
 
 ch0->iir[0].B0=1;
 ch0->iir[0].B1=0;
 ch0->iir[0].B2=0;
 ch0->iir[0].A1=0;
 ch0->iir[0].A2=0;
 
 ch0->iir[1].B0=1;
 ch0->iir[1].B1=0;
 ch0->iir[1].B2=0;
 ch0->iir[1].A1=0;
 ch0->iir[1].A2=0;
 
 ch0->iir[2].B0=1;
 ch0->iir[2].B1=0;
 ch0->iir[2].B2=0;
 ch0->iir[2].A1=0;
 ch0->iir[2].A2=0;
 

 EnableAxisDest(0,ch0->Position);  // Enable ch0 servo where we currently are
 
  // rotate until we find the index mark for ch1
 
 ch1->Enable=FALSE;
 ch1->OutputChan0=10;
 for (;;)
    {
     WaitNextTimeSlice();
  
  Write3PH(ch1,A, ++k/10000.0);  // move the pole
 
  if (ReadBit(67))  // check for index mark
  {
   p0=ch1->Position; // save position
   ch1->Position=0;  // set current position to Zero
   
   ch1->CommutationOffset = -395;
   
   printf("Position Y axis = %f\n",p0);
   break;
  }
    }
 
 Write3PH(ch1,0,0);    // turn off the coil   
 
 // define the axis as 3 phase BRUSHLESS_3PH_MODE
 // and set low PID gains
 
 ch1->InputMode=ENCODER_MODE;
 ch1->OutputMode=BRUSHLESS_3PH_MODE;
 ch1->Vel=150000;
 ch1->Accel=1e+008;
 ch1->Jerk=1e+010;
 ch1->P=0.1;
 ch1->I=0;
 ch1->D=0;
 ch1->FFAccel=0;
 ch1->FFVel=0;
 ch1->MaxI=200;
 ch1->MaxErr=100000;
 ch1->MaxOutput=2000;
 ch1->DeadBandGain=1;
 ch1->DeadBandRange=0;
 ch1->InputChan0=10;
 ch1->InputChan1=4;
 ch1->OutputChan0=10;
 ch1->OutputChan1=9;
 ch1->MasterAxis=-1;
 ch1->LimitSwitchOptions=0x4a48001f;
 ch1->InputGain0=-1;
 ch1->InputGain1=1;
 ch1->InputOffset0=0;
 ch1->InputOffset1=0;
 ch1->OutputGain=1;
 ch1->OutputOffset=0;
 ch1->SlaveGain=1;
 ch1->BacklashMode=BACKLASH_OFF;
 ch1->BacklashAmount=0;
 ch1->BacklashRate=0;
 ch1->invDistPerCycle=-0.0002;
 ch1->Lead=0;
 ch1->MaxFollowingError=400000;
 ch1->StepperAmplitude=20;
 
 ch1->iir[0].B0=1;
 ch1->iir[0].B1=0;
 ch1->iir[0].B2=0;
 ch1->iir[0].A1=0;
 ch1->iir[0].A2=0;
 
 ch1->iir[1].B0=1;
 ch1->iir[1].B1=0;
 ch1->iir[1].B2=0;
 ch1->iir[1].A1=0;
 ch1->iir[1].A2=0;
 
 ch1->iir[2].B0=1;
 ch1->iir[2].B1=0;
 ch1->iir[2].B2=0;
 ch1->iir[2].A1=0;
 ch1->iir[2].A2=0;
 
 
 EnableAxisDest(1,ch1->Position);  // Enable ch1 servo where we currently are
 
 DefineCoordSystem(0,1,-1,-1);
}
 
Thanks for looking it over,
David.
 
 -----Original Message-----
From: DynoMotion@yahoogroups.com [mailto:DynoMotion@yahoogroups.com]On Behalf Of Tom Kerekes
Sent: Friday, December 07, 2012 4:15 PM
To: DynoMotion@yahoogroups.com
Subject: Re: [DynoMotion] KMotionCNC Question

 

Hi David,

User Button (Init C Program) should re-initialize while in the limit if you are using the "Disable drive into limit" mode.  If you post your Init.c program I can look at it.

Regards
TK

Group: DynoMotion Message: 6239 From: Tom Kerekes Date: 12/7/2012
Subject: Re: KMotionCNC Question
Hi David,

Strange.  I don't see anything wrong and I tried it (simulating limits) and don't see a problem.

What happens exactly?  After you hit a limit and push the Init button?  What if anything is printed on the Console Screen?  Are the Axes enabled on the Axis Screen?

What Version are you using?

Regards
TK

Group: DynoMotion Message: 6240 From: David Stevenson Date: 12/7/2012
Subject: Re: KMotionCNC Question

Hi Tom,
 
I will fire it up tomorrow morning and post the details.
 
Thanks for your help,
David.
 
-----Original Message-----
From: DynoMotion@yahoogroups.com [mailto:DynoMotion@yahoogroups.com]On Behalf Of Tom Kerekes
Sent: Friday, December 07, 2012 5:43 PM
To: DynoMotion@yahoogroups.com
Subject: Re: [DynoMotion] KMotionCNC Question

 

Hi David,

Strange.  I don't see anything wrong and I tried it (simulating limits) and don't see a problem.

What happens exactly?  After you hit a limit and push the Init button?  What if anything is printed on the Console Screen?  Are the Axes enabled on the Axis Screen?

What Version are you using?

Regards
TK

Group: DynoMotion Message: 6241 From: David Stevenson Date: 12/7/2012
Subject: Re: KMotionCNC Question

Hi Tom,
 
WOW, that KMotionCNCDlg.cpp is quite a file!  Does that file get compiled and loaded when the software runs, or is there a compiled version that runs when CNC starts? I ask because if a couple of minor changes were made to the code it could help with how my system (reverse a couple of movement settings) works. This mainly because of where the controller is positioned on the machine.
 
Thanks,
David.
 
-----Original Message-----
From: DynoMotion@yahoogroups.com [mailto:DynoMotion@yahoogroups.com]On Behalf Of Tom Kerekes
Sent: Friday, December 07, 2012 3:46 PM
To: DynoMotion@yahoogroups.com
Subject: Re: [DynoMotion] KMotionCNC Question

 

Hi David,

I don't recall what kind of system you have, but the Limits trip on commanded motion in the wrong direction, not actual (encoder) motion in the wrong direction, so I'm not sure why there would be a problem.

The source code is available see KMotionCNCDlg.cpp.  But KMotionCNC is written in MFC (Microsoft Foundation Class) which is an older C++ Libraries which is not supported by the free Express versions.  You need at least the Standard Version of Visual Studio.

Regards
TK

Group: DynoMotion Message: 6243 From: Tom Kerekes Date: 12/8/2012
Subject: Re: KMotionCNC Question
Hi David,

That KMotionCNCDlg.cpp is mostly all of the Windows GUI for KMotionCNC.  It is compiled by VS2008 Standard Version as part of KMotionCNC.exe and runs on the PC.  For changes to the GamePad look into the DoJoyStick() function.

Regards
TK

Group: DynoMotion Message: 6244 From: David Stevenson Date: 12/8/2012
Subject: Re: KMotionCNC Question

Hi Tom,
 
So if I change the .cpp file on my system, will my interface change?
 
Thanks,
David.
 
-----Original Message-----
From: DynoMotion@yahoogroups.com [mailto:DynoMotion@yahoogroups.com]On Behalf Of Tom Kerekes
Sent: Saturday, December 08, 2012 11:21 AM
To: DynoMotion@yahoogroups.com
Subject: Re: [DynoMotion] KMotionCNC Question

 

Hi David,

That KMotionCNCDlg.cpp is mostly all of the Windows GUI for KMotionCNC.  It is compiled by VS2008 Standard Version as part of KMotionCNC.exe and runs on the PC.  For changes to the GamePad look into the DoJoyStick() function.

Regards
TK

Group: DynoMotion Message: 6245 From: Tom Kerekes Date: 12/8/2012
Subject: Re: KMotionCNC Question
Hi David,

If you also use VS2008 Standard Version and re-compile KMotionCNC.exe

Regards
TK

Group: DynoMotion Message: 6246 From: David Stevenson Date: 12/8/2012
Subject: Re: KMotionCNC Question

Thanks Tom.
 
I wasn't sure if it was a separate routine that is called by KMotionCNC.exe
 
David
-----Original Message-----
From: DynoMotion@yahoogroups.com [mailto:DynoMotion@yahoogroups.com]On Behalf Of Tom Kerekes
Sent: Saturday, December 08, 2012 3:33 PM
To: DynoMotion@yahoogroups.com
Subject: Re: [DynoMotion] KMotionCNC Question

 

Hi David,

If you also use VS2008 Standard Version and re-compile KMotionCNC.exe

Regards
TK

Group: DynoMotion Message: 6251 From: David Stevenson Date: 12/10/2012
Subject: Re: KMotionCNC Question

Hi Tom,
 
When I jog into a limit, that axis is disabled. Console says axis is disabled due to limit switch. Initialization doesn't do anything except disable the other axis.  HOWEVER, the homeaxis User button does still work and resets the two axis to working status. I guess I never tried the Homing button in that situation.  :)
 
So I guess everything is good!
 
Thanks for your help (and for 430g too),
David.
 
-----Original Message-----
From: DynoMotion@yahoogroups.com [mailto:DynoMotion@yahoogroups.com]On Behalf Of Tom Kerekes
Sent: Friday, December 07, 2012 5:43 PM
To: DynoMotion@yahoogroups.com
Subject: Re: [DynoMotion] KMotionCNC Question

 

Hi David,

Strange.  I don't see anything wrong and I tried it (simulating limits) and don't see a problem.

What happens exactly?  After you hit a limit and push the Init button?  What if anything is printed on the Console Screen?  Are the Axes enabled on the Axis Screen?

What Version are you using?

Regards
TK